package com.hl.mapper;

import com.hl.pojo.AnswerLeaveWord;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AnswerLeaveWordMapper {

    @Insert("insert into answer_leave_word (leave_word, answer, consultant_id) values ( #{leaveWord}, #{answer}, #{consultantId})")
    Integer add(AnswerLeaveWord answerLeaveWord);

    @Update("update answer_leave_word set leave_word=#{leaveWord}, answer=#{answer}, consultant_id=#{consultantId} where id=#{id} and del = 0")
    Integer update(AnswerLeaveWord answerLeaveWord);

    @Update("update answer_leave_word set del=1 where id=#{id}")
    Integer delete(String id);

    @Select("select * from answer_leave_word where id=#{id} and del = 0")
    AnswerLeaveWord findById(String id);
    @Select("select * from answer_leave_word where consultant_id=#{consultantId} and del = 0")
    List<AnswerLeaveWord> findByConsultantId(Integer consultantId);

    @Select("select * from answer_leave_word where del = 0")
    List<AnswerLeaveWord> findAll();
}